<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="/WEB-INF/pagination.tld" prefix="page"%>
<%
String path = request.getContextPath();


	String month = "1";
	if(null!=request.getParameter("month")){month = request.getParameter("month");}
	if(null!=request.getAttribute("month")){month = (String)request.getAttribute("month");}

%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  
    <title>My JSP 'newjiaoxue_content.jsp' starting page</title>
 	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="<%=path %>/reference/css/Beike.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<%=path %>/reference/js/jquery.js"></script>
	
	<script type="text/javascript">
	
		//添加月主题领域目标
		function addmonthinfo(){
			window.document.frm.action="<%=path %>/beike/cmonthinfo.do?method=addMonthInfo";
			frm.submit();
		}
		//添加月主题内容
		function addmonthcontent(){
			window.document.frm.action="<%=path %>/beike/iaiminfo.do?method=addMonthContent";
			frm.submit();
		}
		//删除月主题内容
		function delmonthcontent(id){
			if(window.confirm("确定要删除吗？")){
			var month = $("#month").val();
				window.location.href="<%=path %>/beike/imonthcontent.do?method=delIMonthcontent&id="+id+"&month="+month+"&targetId=${targetId}&edit=${edit}";
			}
			
		}
		//编辑
		function editcontent(tid){
				
				document.getElementById("subbtton").src="<%=path %>/reference/images/button_save.gif";
				document.getElementById("frm").action="<%=path %>/beike/imonthcontent.do?method=updateMonthcontent&cid="+tid;
				$("#imonthContent").val($("#td"+tid).text());
				
			}
	</script>
  </head>
  
  <body>
  		<form action="${pageContext.request.contextPath}/beike/imonthcontent.do?method=saveIMonthcontent" name="frm" method="post" id="frm">
  				<input type="hidden" name="month" id="month" value="<%=month %>" />
  				
  				<input type="hidden" name="edit" id="edit" value="${edit }" />
  				<input type="hidden" name="targetId" id="targetId" value="${targetId }" />
  				
                    <table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#cfe5f5">
                     
                     <tr>
                     	<td colspan="4">
                     	<table>
                     		<tr>
	                     	<td bgcolor="#F5F5F5"  width="150">月主题名称：</td>
							<td bgcolor="#F5F5F5" colspan="3" align="left">&nbsp;<input type="text" value="${monthContent }" name="monthContent" size="100"/></td>
	                		 </tr>
                     	
                     	</table>
                     	</td>
                     </tr>
                    
                    <tr>
                      <td width="6%" height="25" bgcolor="#a4c9ec">&nbsp;序号</td>
                      <td width="66%" height="25" align="center" bgcolor="#a4c9ec"><strong>月目标内容</strong></td>
                      <td width="11%" align="center" bgcolor="#a4c9ec"><strong>编 辑</strong></td>
                      <td width="17%" align="center" bgcolor="#a4c9ec"><strong>删 除</strong></td>
                    </tr>
                    <c:forEach items="${monthcontents}" var="info" varStatus="staut">
	                    <tr>
	                      <td width="6%" height="30" bgcolor="#FFFFFF">${staut.count+(currPage-1)*pageSize }.</td>
	                      <td height="30" align="center" bgcolor="#FFFFFF" id="td${info.id }">${info.monthcontent }</td>
	                      <td height="30" align="center" bgcolor="#FFFFFF"><a href="javascript:editcontent(${info.id });"><img src="<%=path %>/reference/images/bianji.gif" alt="" width="16" height="16" border="0"></a></td>
	                      <td height="30" align="center" bgcolor="#FFFFFF"><a href="javascript:delmonthcontent(${info.id });"><img src="<%=path %>/reference/images/de.gif" alt="" width="16" height="16" border="0"></a></td>
	                    </tr>
               		</c:forEach>
                  </table>
                <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
                    <tr>
                      <td bgcolor="#e6f0f8"><table width="100%" border="0" cellspacing="0" cellpadding="3">
                          <tr>
                            <td align="right">
                               	<page:Pagination url="${pageContext.request.contextPath}/beike/imonthcontent.do?method=getIMonthcontent&month=${month }" currPage="${empty currPage?1:currPage}" pageAmount="${pageAmount}" pageSize="${empty pageSize?10:pageSize}" type="post" form="frm" />
						    </td>
                          </tr>
                      </table></td>
                    </tr>
                  </table>
                  
                  <table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF">
                    <tr>
                      <td bgcolor="#e6f0f8"><table width="100%" border="0" cellspacing="0" cellpadding="3">
                          <tr>
                            <td width="68%" align="right"><input name="imonthContent" id="imonthContent" type="text" style="width:100%" ></td>
                            <td width="32%"><a href="javascript:frm.submit();"><img src="<%=path %>/reference/images/button_add.gif" id="subbtton" width="44" height="20" border="0"></a></td>
                          </tr>
                      </table></td>
                    </tr>
                  </table>
                  </form>
  </body>
</html>
